slowmain = print (filter even (filter (<4000000) (map sfib [1..])))

sfib 1 = 1
sfib 2 = 2
sfib n = sfib (n-1) + sfib (n-2)

main = print (sum (filter even (fib 4000000)))

fib limit = fibb limit [2, 1] where
		fibb limit xs = if head xs > limit 
			then tail xs
			else fibb limit (sum (take 2 xs) : xs)


fibbo = iterate fibby 1 where
			fibby xs = if length xs == 1
				   then 2
				   else sum (take 2 xs)
